﻿namespace com.huawei.esdk.tp.professional.eSDKTPProfessionalOrgaMgr
{
    using System;
    using System.Web.Services;
    using System.Diagnostics;
    using System.Web.Services.Protocols;
    using System.ComponentModel;
    using System.Xml.Serialization;
    using System.Xml;
    using com.huawei.esdk.tp.professional.DataType;


    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Web.Services.WebServiceBindingAttribute(Name = "TPProfessionalOrgaMgrServiceSoapBinding", Namespace = "http://smc.huawei.com/")]
    public partial class TPProfessionalOrgaMgrService : System.Web.Services.Protocols.SoapHttpClientProtocol
    {

        private System.Threading.SendOrPostCallback queryOrganizationExOperationCompleted;

        /// <remarks/>
        public TPProfessionalOrgaMgrService()
        {
            this.Url = "http://localhost:8086/";
        }

        public TPProfessionalOrgaMgrService(string url)
        {
            System.Net.ServicePointManager.CertificatePolicy = new com.huawei.esdk.tp.professional.Utils.MyCertificatePolicy();
            this.Url = url;
        }

        /// <remarks/>
        public event queryOrganizationExCompletedEventHandler queryOrganizationExCompleted;

        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smc.huawei.com/queryOrganizationEx", RequestNamespace = "http://smc.huawei.com/", ResponseNamespace = "http://smc.huawei.com/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        [return: System.Xml.Serialization.XmlElementAttribute("resultCode", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public int queryOrganizationEx(
            [System.Xml.Serialization.XmlElementAttribute("orgs", Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = true)] out OrganizationItemEx[] orgs)
        {
            object[] results = this.Invoke("queryOrganizationEx", new object[0]);
            orgs = ((OrganizationItemEx[])(results[1]));
            return ((int)(results[0]));
        }

        /// <remarks/>
        public void queryOrganizationExAsync()
        {
            this.queryOrganizationExAsync(null);
        }

        /// <remarks/>
        public void queryOrganizationExAsync(object userState)
        {
            if ((this.queryOrganizationExOperationCompleted == null))
            {
                this.queryOrganizationExOperationCompleted = new System.Threading.SendOrPostCallback(this.OnqueryOrganizationExOperationCompleted);
            }
            this.InvokeAsync("queryOrganizationEx", new object[0], this.queryOrganizationExOperationCompleted, userState);
        }

        private void OnqueryOrganizationExOperationCompleted(object arg)
        {
            if ((this.queryOrganizationExCompleted != null))
            {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.queryOrganizationExCompleted(this, new queryOrganizationExCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }

        /// <remarks/>
        public new void CancelAsync(object userState)
        {
            base.CancelAsync(userState);
        }

        private bool IsLocalFileSystemWebService(string url)
        {
            if (((url == null)
                        || (url == string.Empty)))
            {
                return false;
            }
            System.Uri wsUri = new System.Uri(url);
            if (((wsUri.Port >= 1024)
                        && (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0)))
            {
                return true;
            }
            return false;
        }
    }

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")]
    public delegate void queryOrganizationExCompletedEventHandler(object sender, queryOrganizationExCompletedEventArgs e);

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class queryOrganizationExCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
    {

        private object[] results;

        internal queryOrganizationExCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
            base(exception, cancelled, userState)
        {
            this.results = results;
        }

        /// <remarks/>
        public int Result
        {
            get
            {
                this.RaiseExceptionIfNecessary();
                return ((int)(this.results[0]));
            }
        }

        /// <remarks/>
        public OrganizationItemEx[] orgs
        {
            get
            {
                this.RaiseExceptionIfNecessary();
                return ((OrganizationItemEx[])(this.results[1]));
            }
        }
    }
}
